#include <stdio.h>
#include <stdlib.h>

int* findErrorNums(int* nums, int numsSize, int* returnSize)
{
    int *m = malloc(sizeof(int)*2);
    *returnSize = 2;
    for(int i = 0;i < numsSize;i++)
    {
        for(int j = i + 1;j < numsSize;j++)
        {
            if(nums[i] == nums[j])
            {
                m[0] = nums[i];
                m[1] = j +1;
                return m;
            }
        }
    }

}

int main()
{
    int nums[] = {1,2,2,4};
    int numsSize = sizeof(nums)/sizeof(nums[0]);
    int returnSize = 0;
    int * m = findErrorNums(nums,numsSize,&returnSize);
    for(int i = 0;i < 2;i++)
    {
        printf("%d ",m[i]);
    }
    free(m);
    return 0;
}